package com.yyj.dao;

import com.yyj.entity.Rescue;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RescueDao {
    @Insert("insert into rescue(description,sendTime,discoverSpot,contact,userId,title,content) values (#{description},#{sendTime},#{discoverSpot},#{contact},#{userId},#{title},#{content})")
    void addRescue(Rescue rescue);

    @Select("select rescue.*,user.avatar,user.name from rescue left join user on rescue.userId=user.userId where sendTime=#{sendTime}")
    List<Rescue> getRescue(String sendTime);

}
